﻿using mojoPortal.Business;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Text;

namespace blackhouse.mojoPortalExtend {
    public static class Extensions {

        public static int GetSiteId(this CultureInfo culture) {
            int siteCounts = SiteSettings.SiteCount();
            for (int xs = 0; xs <= siteCounts; xs++) {
                string siteCulture = ConfigurationManager.AppSettings["site" + xs + "culture"];
                if (
                    !String.IsNullOrEmpty(siteCulture)
                    && siteCulture.Equals(culture.Name, StringComparison.InvariantCultureIgnoreCase)) {
                    return xs;
                }
            }
            return -1;
        }

    }
}
